package com.yidu.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;

import com.yidu.bean.TbManagerRole;
import com.yidu.dao.TbManagerRoleMapper;
import com.yidu.message.Page;
import com.yidu.service.TbManagerRoleService;

/**
 * 类的描述--
 * @author 楠竹
 * @date 2018年7月24日
 * @version 1.0
 */
@Service
public class TbManagerRoleServiceImpl implements TbManagerRoleService {
	
	@Resource
	private TbManagerRoleMapper managerRoleDao;
	
	//控制台打印
	Logger logger = Logger.getLogger(TbManagerRoleServiceImpl.class);

	/* (non-Javadoc)
	 * @see com.yidu.service.TbManagerRoleService#delete(java.lang.String)
	 */
	@Override
	public int delete(String mrId) {
		logger.info("进入删除...");
		int num = managerRoleDao.deleteByPrimaryKey(mrId);
		
		return num;
	}

	/* (non-Javadoc)
	 * @see com.yidu.service.TbManagerRoleService#save(com.yidu.bean.TbManagerRole)
	 */
	@Override
	public int save(TbManagerRole mr) {
		logger.info("进入增加...");
		int num = managerRoleDao.insertSelective(mr);
		
		return num;
	}

	/* (non-Javadoc)
	 * @see com.yidu.service.TbManagerRoleService#update(com.yidu.bean.TbManagerRole)
	 */
	@Override
	public int update(TbManagerRole mr) {
		logger.info("进入修改...");
		int num = managerRoleDao.updateByPrimaryKey(mr);
		
		return num;
	}

	/* (non-Javadoc)
	 * @see com.yidu.service.TbManagerRoleService#findVague(com.yidu.message.Page, com.yidu.bean.TbManagerRole)
	 */
	@Override
	public List<TbManagerRole> findVague(Page page, TbManagerRole mr) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int deleteMan(String manId) {
		logger.info("进入根据用户删除用户角色...");
		int num = managerRoleDao.delete(manId);
		return num;
	}

	@Override
	public List<TbManagerRole> findRole(String manId) {
		logger.info("查询用户的角色...");
		List<TbManagerRole> list = managerRoleDao.findRole(manId);
		return list;
	}

}
